package org.xyl.game.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import org.springframework.transaction.annotation.Transactional;
import org.xyl.game.dao.UserinfoDao;
import org.xyl.game.entity.Userinfo;
import org.xyl.game.service.UserInfoService;

@Service
public class UserInfoServiceImpl implements UserInfoService {
    @Autowired
    UserinfoDao userInfoDao;

    @Override
    public Userinfo findUserInfo(String userName) {
        return userInfoDao.findByUsername(userName);
    }
    @Override
    @Transactional
    public Userinfo addUserinfo(String username, String password){
        Userinfo saveUserinfo=new Userinfo();
        saveUserinfo.setUsername(username);
        saveUserinfo.setPassword(password);
        Userinfo save = userInfoDao.save(saveUserinfo);
        return save;

    }
}
